CREATE OR REPLACE FUNCTION inc_nb_comments_function() RETURNS TRIGGER AS $$
    BEGIN
       UPDATE entries SET has_comments = has_comments + 1 WHERE id_entry IN (SELECT id_entry FROM inserted);
    END;
$$ LANGUAGE plpgsql;


